<template>
	<view class="shopping" @tap="fun()">
		<img src="../../static/cart line.png" alt="">
		<div class="red" v-show="show"><text>{{num}}</text></div>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				ok: '',
				show:true
			};
		},
		props:['num'],
		onUnload() {
			// uni.$off('set')
		},
		onLoad() {
			if(this.num<0){
				this.show=false
			}else{
				this.show=true
			}
		},
		methods: {
			fun() {
				uni.navigateTo({
					url: '../gogo/gogo'
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.shopping {
		position: fixed;
		bottom: 86px;
		left: 10px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		text-align: center;
		align-items: center;
		background-color: #000000A6;

		img {
			position: absolute;
			margin: 0 auto;
			top: 10px;
			bottom: 0;
			right: 0;
			left: 0;
			width: 30px;
			height: 30px;

		}

		.red {
			position: absolute;
			right: -5px;
			width: 20px;
			height: 20px;
			background-color: #ff4444;
			border-radius: 50%;
			color: #fff;
		}
	}
</style>